<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->params['static'].'assets/js/bootbox.min.js',2); ?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->params['static'].'assets/js/validateEngine/jquery.validationEngine.min.js',2); ?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->params['static'].'assets/js/validateEngine/jquery.validationEngine-zh_CN.js',2); ?>
<?php Yii::app()->clientScript->registerCssFile(Yii::app()->params['static'].'assets/css/validationEngine.jquery.css'); ?>
<div class="page-header">
							<h1>
							编辑 <strong><?php echo $stu->realName; ?></strong> 个人信息
							</h1>
</div>
<div class="row">
 <div class="col-xs-12">
 <div class="row">
       <div class="widget-box">
					<div class="widget-header widget-header-small">
						<h5 class="lighter"></h5>
					</div>
                       <div class="widget-body">
							<div class="widget-main">
  <form class="form-horizontal" id="form_person" name="person" method = "post" action="<?php echo Yii::app()->createUrl('basicinfo/update',array('uId'=>Yii::app()->request->getParam('uId'))); ?>">

     <div class="form-group">
      <div class="col-sm-2">
	     <label for="" class="control-label">个人照片</label>
		 <?php
		     if($stu->pictureUrl == '')
				 echo ' <img class="img-responsive" style="height:164px;width:216px;" src="'.Yii::app()->baseUrl.'/images/no2.jpg">';
			 else
				 echo ' <img class="img-responsive" style="height:164px;width:216px;" src="'.Yii::app()->baseUrl.$stu->pictureUrl.'">';
		 ?>
		
	 </div>
	 <div class="col-sm-2">
		<label for="" class="control-label">姓名</label>
		 <input data-rel="tooltip" data-original-title="必填" type="text" class="form-control validate[required]" name="realName" id="" value="<?php echo $stu->realName; ?>">
         <label for="" class="control-label">学号</label>
		<input data-rel="tooltip" data-original-title="必填" type="text" class="form-control validate[required]" name = "stuNumber" value="<?php echo $stu->stuNumber; ?>">
	    <label for="" class="control-label">身份证号</label>
		<input data-rel="tooltip" data-original-title="必填" type="text" class="form-control validate[required,custom[number]]" name = "idNum" value="<?php echo $stu->idNum; ?>">
    </div>
	 <div class="col-sm-2">
		<label for="" class="control-label">个人电话</label>
		<input data-rel="tooltip" data-original-title="填写以便于联系" type="text" class="form-control validate[required,custom[phone]]" name="phoneNum" value="<?php echo $stu->phoneNum; ?>" placeholder="">
        <label for="" class="control-label">家长电话</label>
		<input  data-rel="tooltip" data-original-title="填写以便于联系" type="text" class="form-control validate[required,custom[phone]]" name="parentNum" value="<?php echo $stu->parentNum; ?>" placeholder="">
       <label for="" class="control-label">家庭地址</label>
		<input data-rel="tooltip" data-original-title="填写以便于联系" type="text" class="form-control validate[required]" name="homePlace"  value="<?php echo $stu->homePlace; ?>" placeholder="">
	</div>
	
    <div class="col-sm-3">
		<label class="control-label">年级</label>
          <div class="controls">
            <select class="form-control" name="grade">
			<?php
			   $currentYear = date('Y');
			   $currentYear = (int)$currentYear - 5;
			   for($i = 5;$i>=0;$i--){
				   $y = $currentYear++;
				   if((int)$stu->grade == $y){
					echo ' <option value="'.$y.'" selected="selected" >'.$y.'</option>';
				   }else
				   echo ' <option value="'.$y.'">'.$y.'</option>';
				   
			   }
			?>
              
            </select>
          </div> 
       <label for="" class="control-label">银行卡号</label>
		<input data-rel="tooltip" data-original-title="填写以便于联系" type="text" class="form-control validate[required,custom[number]]" name="bankNum"  value="<?php echo $stu->bankNum; ?>" placeholder="">
		 <label class="control-label">选择银行</label>
          <div class="controls">
            <select class="form-control" name="bankName">
			<?php
			  $banks = array("中国工商银行","招商银行","中国农业银行","中国建设银行","中国银行","中国民生银行","中国光大银行","中信银行","交通银行","兴业银行","中国农业发展银行","中国邮政储蓄银行","中国人民银行","华夏银行");
			  foreach($banks as $b){
				  if($stu->bankName == $b)
					echo '<option value="'.$b.'" selected = "selected">'.$b.'</option>';
				  else
					echo '<option value="'.$b.'" >'.$b.'</option>';
				}
			?>
              
              
            </select>
          </div>
	</div>
	 <div class="col-sm-3">
		 <label for="" class="control-label">寝室号</label>
		 <input data-rel="tooltip" data-original-title="填写以便于联系" type="text" class="form-control validate[required]" name="dormNum"  value="<?php echo $stu->dormNum; ?>" placeholder="">
		  <label for="" class="control-label">民族</label>
		 <input data-rel="tooltip" data-original-title="填写以便于联系" type="text" class="form-control validate[required]" name="nation"  value="<?php echo $stu->nation; ?>" placeholder="">
		<label class="control-label">专业</label>
          <div class="controls">
            <select class="form-control validate[required]" name="major">
			<option value="">&nbsp;&nbsp;&nbsp;&nbsp;</option>
			<?php
			  
			  foreach($major as $m){
				  if($stu->major == $m->name)
				   echo '<option value="'.$m->name.'" selected="selected">'.$m->name.'</option>';
				  else
				  echo '<option value="'.$m->name.'" >'.$m->name.'</option>';
				  
			  }
			?>
              
            </select>
          </div> 
		 
    </div>
 </div>
 <div class="form-group">
     <div class="col-sm-2">
		
	</div>
	 <div class="col-sm-4">
	
		  <label class="control-label">班级</label>
          <div class="controls">
            <select class="form-control validate[required]" name="classRoom">
			<option value="" id="classroom-after">&nbsp;&nbsp;&nbsp;&nbsp;</option>
			<?php
			   if($stu)
				   echo '<option class="classroom-added" value="'.$stu->classRoom.'" selected="selected">'.$stu->classRoom.'</option>'
			?>
              
            </select>
          </div> 
    </div>
    <div class="col-sm-3">
		
		 <label class="control-label">定向区县</label>
          <div class="controls">
            <select class="form-control" name="directionalDistrict">
             <?php
			   foreach($dds as $d){
				   if($stu->directionalDistrict == $d->name)
					   echo '<option value="'.$d->name.'" selected="selected">'.$d->name.'</option>';
				   else
				   echo '<option value="'.$d->name.'">'.$d->name.'</option>';
			   }
			 ?>
             
            </select>
          </div>
	</div>
	 <div class="col-sm-3">
		    <label class="control-label">性别</label>
          <div class="controls">
            <select class="form-control" name="gender">
              <?php
			     switch($stu->gender){
					 case "男" : echo '<option value="女">女</option><option value="男" selected = "selected">男</option>';break;
					 case "女" : echo '<option value="女" selected="selected">女</option><option value="男" >男</option>';break;
					 default:echo '<option value="女" selected="selected">女</option><option value="男" >男</option>';
				 }
			  ?>
			  
            </select>
          </div>
	</div>
 </div>
 <div class="form-group">
  <div class="col-sm-2">
  </div>
   <div class="col-sm-8">
		  <label for="" class="control-label">备注:</label>
		<textarea name="remark" cols="120" rows="5" > <?php echo $stu->remark; ?></textarea>
	    
	</div>
 </div>
 <div class="form-group">
     <div class="col-sm-5">
	 </div>
	  <div class="col-sm-2">
		<button type="submit" class="btn btn-info">提交</button>
	</div>
 </div>
 
 </form>
    </div>
  </div>
</div>  
</div>
<hr>
<div class="row">
 <div class="widget-box">
	<div class="widget-header widget-header-small">
		<h5 class="lighter">修改学生成绩</h5>
	</div>
      <div class="widget-body">
		<div class="widget-main">
          <form class="form-horizontal" id="form_person" name="person" method = "post" action="<?php echo Yii::app()->createUrl('basicinfo/updateperformance',array('uId'=>$stu->uId)); ?>">
            <div class="form-group">
			   <div class="col-sm-3">
		       <label for="" class="control-label">第一学期</label>
		       <input  type="text" class="form-control validate[required]" name="term_1"  value="<?php echo $stuPer->term_1;?>" placeholder=""> 
	           </div>
               <div class="col-sm-3">
		       <label for="" class="control-label">第二学期</label>
		       <input  type="text" class="form-control validate[required]" name="term_2"  value="<?php echo $stuPer->term_2;?>" placeholder=""> 
	           </div>
			   <div class="col-sm-3">
		       <label for="" class="control-label">第三学期</label>
		       <input  type="text" class="form-control validate[required]" name="term_3"  value="<?php echo $stuPer->term_3;?>" placeholder=""> 
	           </div>
			   <div class="col-sm-3">
		       <label for="" class="control-label">第四学期</label>
		       <input  type="text" class="form-control validate[required]" name="term_4"  value="<?php echo $stuPer->term_4;?>" placeholder=""> 
	           </div>			   
			</div>
			<div class="form-group">
			   <div class="col-sm-3">
		       <label for="" class="control-label">第五学期</label>
		       <input  type="text" class="form-control validate[required]" name="term_5"  value="<?php echo $stuPer->term_5;?>" placeholder=""> 
	           </div>
               <div class="col-sm-3">
		       <label for="" class="control-label">第六学期</label>
		       <input  type="text" class="form-control validate[required]" name="term_6"  value="<?php echo $stuPer->term_6;?>" placeholder=""> 
	           </div>
			   <div class="col-sm-3">
		       <label for="" class="control-label">第七学期</label>
		       <input  type="text" class="form-control validate[required]" name="term_7"  value="<?php echo $stuPer->term_7;?>" placeholder=""> 
	           </div>
			   <div class="col-sm-3">
		       <label for="" class="control-label">第八学期</label>
		       <input  type="text" class="form-control validate[required]" name="term_8"  value="<?php echo $stuPer->term_8;?>" placeholder=""> 
	           </div>			   
			</div>
			 <div class="form-group">
				 <div class="col-sm-5">
				 </div>
				  <div class="col-sm-2">
					<button type="submit" class="btn btn-info">提交</button>
				</div>
			 </div>
		  </form>
		</div>
      </div>
 </div>	  
</div>
<script type="text/javascript">
 jQuery(function($){
	
	  var classRoom;
	  <?php
	    $data = array();
		foreach($major as $m){
			$data[$m->name] = array();
			$classes = $m->classrooms;
			foreach($classes as $c){
				$data[$m->name][] = $c->name; 
			}
		}
	   echo 'classRoom = '.json_encode($data);
	  ?>
	  
	  $('[name="major"]').on('change',function(){
		 $('.classroom-added').remove();
		var major = $(this).val();
        for(c in classRoom[major]){
			text = '<option class="classroom-added" value="'+classRoom[major][c]+'">'+classRoom[major][c]+'</option>';
			$('#classroom-after').after(text);
		}		
		 
		  
	  });
	
	<?php
	   if(Yii::app()->user->hasFlash('update')){
		   echo 'bootbox.alert("'.Yii::app()->user->getFlash('update').'",function(){});';
		   
	   }
	?>
	
  $('[data-rel=popover]').popover({container:'body'});
  
  //begin the validate
  $(".form-horizontal").validationEngine("attach",{ 
		promptPosition:"topRight", 
		scroll:true,
		validateNonVisibleFields:false,
  }); 
 });

 
</script>